#分割
text = "apple,banana,orange"
print(text.split(","))
print(text.split(",", 1))

#连接
a = "Hello"
b = "World"
print(a+b)
print(a, b)
print('Hadoop''Hive')

#替换
text = "Hello World"
new_text = text.replace("World", "Python")
new_text = text.replace("l", "x", 2)

#占位符
text = "Hello World{}"
a = text.format(123)
print(a)

#追加
text =[1,23,333,3]
text.append(44)
print(text)

#join分割
b = ("Hello", "World")
a = "-".join(b)
print(a)

#将字符串中的所有小写字母转换为大写字母
text = "Hello, World!"
print(text.upper())

#将所有字符全部小写的
text = "HELLO, WORLD!"
print(text.lower())

#字符串中的旧子串替换为新子串
s = "apple cats."
b = s.replace("cats", "dogs")
print(b)

#将变量插入到字符串的占位符中
name = "Xukun Cai"
age = 25
print("My name is {0}, I'm {1}. {0} loves Python.".format(name, age))

#移除并返回列表的最后一个元素
a = [1, 2, 3, 4]
b = a.pop()
print(a)
print(b)

#每个元素依次添加到原列表末尾
a = [1, 2, 3]
a.extend([4, 5])
print(a)

#移除指定索引位置的元素
q = [1, 2, 3]
print(q.pop())

#删除第一个元素
a= ['apple', 'banana', 'orange', 'apple']
a.remove('apple')
print(a)

#默认从列表头部开始搜索，仅返回第一个匹配项的索引
demo = ["running", "pending", "error"]
print(demo.index("pending"))

#要统计的元素值
c = [1, 2, 3, 2, 2, 4]
print(c.count(2))

#排序
a = [5, 2, 3, 1, 4]
a.sort(reverse=True)
print(a)

#反转列表元素的顺序
x = [8, 9, 0, 7, 4, 5, 1, 2, 3, 6]
x.reverse()
print(x)

#将元组元素分配给多个变量
i, j, *k = (1, 10, 100, 1000)
print(i, j, *k)

#多个值通过逗号分隔自动组合为元组
a = 1, 10, 100
print(a)

#要查找的子字符串
text = "Hello, world!"
print(text.find("world"))